import json

class JsonResult2:
    def __init__(self):
        pass

    def setOk(self,data=[],msg="ok"):
        rs = {
            "code":0,
            "msg":msg,
            "count":len(data),
            "data":data
        }
        return json.dumps(rs, ensure_ascii=False).encode('utf8')

    def setError(self,msg):
        rs = {
            "code": -1,
            "msg": msg,
            "count": 0,
            "data": []
        }
        return json.dumps(rs)